import request from "../utils/request";

/**
 * 添加用户
 */
export function addUser(data) {
  return request({
    url: "/api/user",
    method: "post",
    data: data,
  });
}

/**
 * 删除用户
 */
export function deleteUser(id) {
  return request({
    url: `/api/user/${id}`,
    method: "delete",
  });
}

/**
 * 更新用户
 */
export function updateUser(data) {
  return request({
    url: "/api/user",
    method: "put",
    data: data,
  });
}

/**
 * 用户详情
 */
export function getUser(id) {
  return request({
    url: `/api/user/${id}`,
    method: "get",
  });
}

/**
 * 用户列表
 */
export function listUser(query) {
  return request({
    url: "/api/user",
    method: "get",
    params: query,
  });
}

/**
 * 获取当前用户的信息
 */
export function getCurrentUser() {
  return request({
    url: "/api/user/my",
    method: "get",
  });
}
